package com.java.comprehensive.arithmetic.leecode.easy;

/**
 * @program: comprehensive-service
 *
 * @description: 整数反转
 *
 * @author: 窦绍飞
 *
 * @create: 2021-11-23 10:54
 **/
public class LeetCode_07 {

	public static int reverse(int x) {
		if (x == 0)
			return 0;
		long result = 0;
		while (x != 0) {
			result = result * 10 + x % 10;
			x = x / 10;
		}
		return ((int) result) == result ? (int) result :0;
	}

	public static void main(String[] args) {
		int b = -2147483648;
		System.out.println(reverse(b));
	}

}
